from django.views.generic import View
from django.http import HttpResponse


class IndexView(View):
    def get(self, request, *args, **kwargs):
        # 1.设置session
        # request.session['username'] = 'zhiliao'
        # request.session.set_expiry(3600)

        # 2.读取session
        username = request.session.get('username')
        print(username)
        return HttpResponse('首页')
